package us.mooresr.aircraftscheduling.server.handler;


import us.mooresr.aircraftscheduling.server.DAO;
import us.mooresr.aircraftscheduling.shared.action.UpdateReservationAction;
import us.mooresr.aircraftscheduling.shared.action.UpdateReservationResult;

import com.gwtplatform.dispatch.server.ExecutionContext;
import com.gwtplatform.dispatch.server.actionhandler.ActionHandler;
import com.gwtplatform.dispatch.shared.ActionException;

public class UpdateReservationHandler 
	implements ActionHandler<UpdateReservationAction, UpdateReservationResult> {

	@Override
	public UpdateReservationResult execute(UpdateReservationAction arg0,
			ExecutionContext arg1) throws ActionException {
		DAO dao = new DAO();
		
		dao.ofy().put(arg0.getReservation());
		
		return new UpdateReservationResult(arg0.getReservation());
	}

	@Override
	public Class<UpdateReservationAction> getActionType() {
		return UpdateReservationAction.class;
	}

	@Override
	public void undo(UpdateReservationAction arg0,
			UpdateReservationResult arg1, ExecutionContext arg2)
			throws ActionException {
		
		
	}

}
